import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;

public class PasswordTest {
    public static void main(String[] args) {
        BCryptPasswordEncoder encoder = new BCryptPasswordEncoder();
        
        // Test password: admin123
        String rawPassword = "admin123";
        
        // Encrypted password from database script
        String storedPassword = "$2a$10$7JB720yubVSZvUI0rEqK/.VqGOZTH.ulu33dHOiBE8ByOhJIrdAu2";
        
        // Test password matching
        boolean matches = encoder.matches(rawPassword, storedPassword);
        System.out.println("Password 'admin123' matches: " + matches);
        
        // Generate new encrypted password
        String newEncodedPassword = encoder.encode(rawPassword);
        System.out.println("New encrypted password: " + newEncodedPassword);
        
        // Test new password matching
        boolean newMatches = encoder.matches(rawPassword, newEncodedPassword);
        System.out.println("New password matches: " + newMatches);
        
        // Test other possible passwords
        String[] testPasswords = {"admin", "123456", "password", "admin123", "Admin123"};
        for (String testPwd : testPasswords) {
            boolean testMatches = encoder.matches(testPwd, storedPassword);
            System.out.println("Password '" + testPwd + "' matches: " + testMatches);
        }
    }
}
